﻿@model Models.DataModel.Contribution

@{
    ViewBag.Title = "Details";
    Layout = "~/Views/Shared/_Layout.cshtml";

    var id = Model.ContributionId == null ? Guid.NewGuid() : Model.ContributionId;
}

<h2>Details</h2>

<div >
    <h4>Contribution</h4>
	<hr />
    <dl class="dl-horizontal">
        
        <dt>
            @Html.DisplayNameFor(model => model.CompanyNumber)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.CompanyNumber)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.CompanyName)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.CompanyName)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.PortNumber)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.PortNumber)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.PortName)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.PortName)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.LocalNumber)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.LocalNumber)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.HourType)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.HourType)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.LaborType)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.LaborType)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.CreatedOn)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.CreatedOn)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.DateOfContribution)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.DateOfContribution)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.NumberOfHours)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.NumberOfHours)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.CreatedByName)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.CreatedByName)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.TransactionCode)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.TransactionCode)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.Comment)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Comment)
        </dd>

    </dl>
    <div class="table-responsive" id="list">
        <table class="table table-bordered table-condensed" id="tbcontribution">
            <thead>
                <tr>
                   
                    <th>
                        @Html.Label("Fund Code")
                    </th>
                    <th>
                        @Html.Label("Rate")
                    </th>
                    <th>
                        @Html.Label("Percentage")
                    </th>
                    <th>
                        @Html.Label("Amount")
                    </th>
                </tr>
            </thead>
            <tbody class="tbody" id="tbody"></tbody>
        </table>
    </div>
</div>
<p>
    @Html.ActionLink("Back to List", "Index")
</p>
<script>
    $(document).ready(function () {
        LoadContributionFund('@id');
    });
    function LoadContributionFund(id) {
        var i = 0;
        $.ajax({
            url: "/Contribution/GetListContributionFundByContribution/" + id,
            type: "GET",
            contentType: "application/json; charset=utf-8",
            //data: JSON.stringify({ searchtext: searchtext }),
            dataType: "json",
            success: function (result) {
                var html = '';
                $.each(result, function (key, item) {
                    ++i;
                    var style = i % 2 == 0 ? "even" : "odd";
                    html += '<tr class=' + style + '>';
                    html += '<td class="fcode">' + item.FundCode + '</td>';
                    html += '<td>' + item.Rate + '</td>';
                    html += '<td>' + item.Percentage + '</td>';
                    html += '<td>' + item.Amount + '</td>';
                    html += '</tr>';
                });
                $('#list tbody').html(html);
            },
            error: function (errormessage) {
                alert(errormessage.responseText);
            }
        });
    }


</script>